import axios from "axios";

const service = axios.create({
  baseURL: import.meta.env.VITE_BASE_URL,
  timeout: import.meta.env.VITE_TIME_OUT,
});

let env = import.meta.env.VITE_ENVIRONMENT;

service.interceptors.request.use((config) => {
  if(env === 'test')
    console.log("请求>", config);
  return config;
}, (error) => {
  return Promise.reject(error);
});

service.interceptors.response.use((response) => {
  if(env === 'test')
    console.log("响应>", response);
  return response;
}, (error) => {
  return Promise.reject(error);
});

export default service;